package plg.grupo1.Lexico.StateMachineHierarchy;


public class State11 implements State{
	
    private static State11 INSTANCE = null;    
	private State11(){}
	
    private synchronized static void createInstance() {
        if (INSTANCE == null) INSTANCE = new State11();
    }
    
    public static State11 getInstance() {
        if (INSTANCE == null) createInstance();
        return INSTANCE;
    }
    
	public void goNext(){
		
		if(Contexto.isEof()){
			Contexto.genErrorAndGoToInitialState("EOF","'Character'");
		}
		else{
			
			char c = Contexto.getCharAndMoveToNext();//A
			//Contexto.appendToLexema(c);//B
			
			if (Character.isDigit(c)){
				Contexto.appendToControlWordNum(c);//
				Contexto.setCurrentState(State12.getInstance());
			}
			else{
				//error
				Contexto.genErrorAndGoToInitialState(Character.toString(c),"NUMERO");
			}
		}
	}
}